package com.hy.frame.mvvm.simple

import okhttp3.RequestBody
import okhttp3.ResponseBody
import retrofit2.Response
import retrofit2.http.*

interface SimpleService {
    @GET
    suspend fun <T> get(@Url url: String, @QueryMap params: MutableMap<String, Any>? = null, @HeaderMap headers: MutableMap<String, String>? = null): T

    @POST
    @FormUrlEncoded
    suspend fun <T> post(@Url url: String, @QueryMap params: MutableMap<String, Any>? = null, @FieldMap fields: MutableMap<String, Any>? = null, @HeaderMap headers: MutableMap<String, String>? = null): T

    @POST
    @Multipart
    suspend fun <T> upload(@Url url: String, @QueryMap params: MutableMap<String, Any>? = null, @PartMap parts: MutableMap<String, RequestBody>? = null, @HeaderMap headers: MutableMap<String, String>? = null): T

    @GET
    @Streaming
    suspend fun <T> download(@Url url: String, @QueryMap params: MutableMap<String, Any>? = null, @HeaderMap headers: MutableMap<String, String>? = null): Response<ResponseBody>


}